public class Base3Computer_type3_forAssignment {

	public static void main(String[] args) {

		
		
		
		int total_integer = 4;
		
		int total_parentatis = total_integer - 1;
		
		int wanted_digit = total_parentatis;
		
		
		
		
		// compute starts
		


	
		 for(int i  = 0 ; i<  ((int) Math.pow(3, total_parentatis )  )  ; i++)
		{
			 System.out.println(    fillGap(  computeBase3(i), wanted_digit   )    );
		
			
			
		}
		
		
	


		
	}
	
	
 public static String fillGap(String input, int total_digit)
 {
	 String temp = "000000000000";
	 temp = temp + input;
	 
	 
	 temp = temp.substring( temp.length()-total_digit  );
	
	
	 return temp;
	
	 
 }
	
	
	
	public static String computeBase3(int input)
	{
		
		
		if (input!=0) // recursive case
		{
			computeBase3(input/3);
			
			return computeBase3(input/3) + (input%3);
			
		}		
		
		else 
		{
			return "";
		}
	}
}